package org.ix.dynamicapis.model.request;

import org.ix.dynamicapis.constant.SortConstants;
import org.ix.dynamicapis.model.QueryRequest;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Collection;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@ApiModel(description = "接口业务系统查询条件请求实体")
@Getter
@Setter
@ToString
public class ApiSystemQueryRequest extends QueryRequest {

    @ApiModelProperty(value = "接口ID")
    private Integer id;

    @ApiModelProperty(value = "接口ID列表")
    private Collection<Integer> idIn;

    @ApiModelProperty(value = "最小接口ID")
    private Integer idMin;

    @ApiModelProperty(value = "最大接口ID")
    private Integer idMax;

    @ApiModelProperty(value = "业务系统编码")
    private String systemCode;

    @ApiModelProperty(value = "业务系统编码列表")
    private Collection<String> systemCodeIn;

    @ApiModelProperty(value = "业务系统编码包含")
    private String systemCodeContains;

    @ApiModelProperty(value = "是否删除(0否, 1是)")
    private Integer deleted;

    public void setIdRange(Integer[] idRange)  {
        if (idRange == null || idRange.length != 2) {
            return;
        }
        this.idMin = idRange[0];
        this.idMax = idRange[1];
    }

    public void setIdSort(SortConstants sortConstants)  {
        super.orderBy("id", sortConstants);
    }

    public void getIdSort()  {
        super.getOrderBy().getOrDefault("id", null);
    }

    public void setSystemCodeSort(SortConstants sortConstants)  {
        super.orderBy("system_code", sortConstants);
    }

    public void getSystemCodeSort()  {
        super.getOrderBy().getOrDefault("system_code", null);
    }
}
